CSharpTest.Net
Less Than Operator
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Bases Namespace > Comparable<T> Class : Less Than Operator

a
b

Glossary Item Box

Compares two objects

Syntax

Visual Basic (Declaration) 
Public Operator <( _
   ByVal a As Comparable(Of T), _
   ByVal b As Comparable(Of T) _
) As Boolean
C# 
public bool operator <( 
   Comparable<T> a,
   Comparable<T> b
)

Parameters

a
b

Example

Library/Library.Test/TestEquatable.cs

C#Copy Code
Null<int> nil = null;
Null<int> a = 5;
Null<int> b1 = 6;
Null<int> b2 = 6;

Assert.IsTrue(null <= nil);
Assert.IsTrue(nil <= null);
Assert.IsTrue(b1 <= b2);
Assert.IsTrue(a <= b1);
Assert.IsFalse(b1 <= a);
Assert.IsTrue(nil <= a);
Assert.IsFalse(a <= nil);
Assert.IsTrue(null <= a);
Assert.IsFalse(a <= null);

Assert.IsFalse(null < nil);
Assert.IsFalse(nil < null);
Assert.IsFalse(b1 < b2);
Assert.IsTrue(a < b1);
Assert.IsFalse(b1 < a);
Assert.IsTrue(nil < a);
Assert.IsFalse(a < nil);
Assert.IsTrue(null < a);
Assert.IsFalse(a < null);
VB.NETCopy Code
Dim nil As Null(Of Integer) = Nothing
Dim a As Null(Of Integer) = 5
Dim b1 As Null(Of Integer) = 6
Dim b2 As Null(Of Integer) = 6

Assert.IsTrue(Nothing <= nil)
Assert.IsTrue(nil <= Nothing)
Assert.IsTrue(b1 <= b2)
Assert.IsTrue(a <= b1)
Assert.IsFalse(b1 <= a)
Assert.IsTrue(nil <= a)
Assert.IsFalse(a <= nil)
Assert.IsTrue(Nothing <= a)
Assert.IsFalse(a <= Nothing)

Assert.IsFalse(Nothing < nil)
Assert.IsFalse(nil < Nothing)
Assert.IsFalse(b1 < b2)
Assert.IsTrue(a < b1)
Assert.IsFalse(b1 < a)
Assert.IsTrue(nil < a)
Assert.IsFalse(a < nil)
Assert.IsTrue(Nothing < a)
Assert.IsFalse(a < Nothing)

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys